<template>
<div>
  <div style="margin: auto;width: 400px;height: 600px">
    用户名：<el-input v-model="user.username" /><br>
    密码：<el-input type="password" v-model="user.password" /><br>
    <el-button type="primary" @click="login()">登陆</el-button>{{loginStr}}
  </div>
</div>


</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      user:{},
      loginStr:""
    }
  }, methods: {
    login(){
      axios.get("/project/user/login",{params:this.user}).then(resp=>{
        if (resp.data=="ok"){
          this.$router.push("/index");
        }else {
          this.loginStr="登陆失败";
        }
      })
    }
  }
}
</script>

<style scoped>

</style>